import { fromJS } from 'immutable';
import * as constants from './constants';

const defaultState = fromJS({
  nodeData: [],
  buttonLoading: false,
});

export default(state=defaultState, action) => {
  switch(action.type){
    case constants.GETNODES:
      return state.set('nodeData',action.nodeData);
    case constants.BUTTONLOADING:
      return state.set('buttonLoading', action.buttonLoading)
    case constants.RESETNODE:
      return defaultState;
    default: return state;
  }
}
